//
//  ShenPiJuJueView.m
//  JuBoCRM
//
//  Created by iMac on 2024/3/15.
//  Copyright © 2024 iningKe. All rights reserved.
//

#import "ShenPiJuJueView.h"

@implementation ShenPiJuJueView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    
    _insertTxetView.delegate = self;

}
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
    // 获取当前文本框中的文本
    NSString *newText = [textView.text stringByReplacingCharactersInRange:range withString:text];
    
    // 设置最大字符长度
    NSUInteger maxLength = 120;
    
    _numLabel.text = [NSString stringWithFormat:@"%ld/%ld",textView.text.length,maxLength];
    
    // 检查是否超过最大长度
    if (newText.length <= maxLength) {
        return YES; // 允许输入
    } else {
        return NO; // 超过最大长度，禁止输入
    }
}
- (IBAction)manageClick:(UIButton *)sender {
    if (_manageClickBlock) {
        _manageClickBlock(sender.tag);
    }
}

@end
